//创建一个路由器，并暴露出去
import { createRouter, createWebHistory } from "vue-router";
import Home from "@/pages/Home.vue";
import News from "@/pages/News.vue";
import About from "@/pages/About.vue";
import Detail from '@/pages/Detail.vue';
const router = createRouter({
  history: createWebHistory(), //路由器的工作模式
  routes: [
    {
      path: "/home",
      component: Home,
    },
    {
      path: "/about",
      component: About,
    },
    {
      path: "/news",
      component: News,
      children: [
        {
          path: "detail",
          component: Detail,
        },
      ],
    },
    //2024.4.8：增加一个默认的配置，相当于else条件语句的处理
    {
      path: "/",
      redirect: "/home",
    },
  ],
});
 
//2024.4.8 交出去
export default router
